<template>
  <el-card class="box-card" style="width: 1180px">   
    <div slot="header" class="clearfix">
      <el-form :inline="true" :model="query">
        <el-form-item>
          <el-button type="success"
            >放款详情</el-button
          >     
        </el-form-item>
      </el-form>
    </div>      
    <el-table :data="conList" border style="width: 100%">
        <el-table-column prop="id" label="合同号" >
</el-table-column>
      <el-table-column prop="diName" label="姓名" >
      </el-table-column>
      <el-table-column prop="diTel" label="电话"></el-table-column>
        <el-table-column prop="userIdCard" label="身份证号" width="160">
      </el-table-column>
      <el-table-column prop="diType" label="状态">
      </el-table-column>
      <el-table-column prop="receivingBankBranch" label="银行名称">
      </el-table-column>
      <el-table-column prop="receivingBankNumber" label="银行账号" width="160">
      </el-table-column>
      <el-table-column prop="liLoanMoney" label="放款金额">
      </el-table-column>
      <el-table-column prop="diTimeLimit" label="放款期数">
      </el-table-column>
      
      <el-table-column label="操作" width="220">
        <template slot-scope="scope">
          <el-button size="mini" @click="edit(scope.row.id)"
            >放款</el-button
          >
            <el-button type="danger" size="mini"
            >合同详情</el-button
          >

        </template>
      </el-table-column>      
    </el-table>
  </el-card>
</template>

<script>
export default {
  data() {
    return {
        conList:[],
      query:{
      },
      addForm:{},
      updateForm:{},
    };
  },
  methods: {
    edit(id){
        this.$axios.get("/contracts/"+id)
        .then(res=>{
            if(res.data.code==200){
                this.$message.success("打款成功");
                this.loadCons();
            }else{
                alert("汇款公司余额不足");
            }
        })
    },
    loadCons(){
        this.$axios.post("/contracts/all")
        .then(res=>{
            this.conList=res.data.data.list;
        })
    },
  },
  mounted(){
    this.loadCons();
  }
};
</script>